import React, { PureComponent } from 'react';
import { TreeSelect } from 'antd';
import { connect } from 'dva';
import "./form.less"
class StructureTreeSelect extends PureComponent {
    constructor(props) {
        super(props);
        this.state = {

        }
        this.onSelect=this.onSelect.bind(this)
    }
    componentDidMount() {
        if (this.props.onLoaded) {
            this.props.onLoaded(this);
        }
    }
    async onSelect(keys, e) {
        if (this.props.onSelect) {
            this.props.onSelect(keys, e)
        }
    }
  
    render() {
        const { treeData} = this.props;
        return (
            <TreeSelect
                dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
                placeholder="请选择构件"
                treeData={treeData}
                treeDefaultExpandAll
                onSelect={this.onSelect}
            ></TreeSelect>
        )
    }
}
export default connect(
    ({ }) => ({}),
    dispatch => ({

    })
)(StructureTreeSelect);